package com.zhang.event;

import com.zhang.infrastructure.util.BeanUtil;
import com.zhang.infrastructure.util.CacheUtil;
import com.zhang.protocol.login.LoginRequest;
import com.zhang.view.login.ILoginEvent;
import io.netty.channel.Channel;

public class LoginEvent implements ILoginEvent {

    @Override
    public void doLoginCheck(String userId, String userPassword) {
        Channel channel = BeanUtil.getBean("channel", Channel.class);

        channel.writeAndFlush(new LoginRequest(userId, userPassword));

        CacheUtil.userId = userId;
    }

}